package com.ly.learn.generator;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import org.junit.jupiter.api.Test;

/**
 * @Author LY
 * @create 2023/12/21 10:32
 * @Description MySQL 代码生成
 */
public class MySQLGenerator extends BaseGenerator{

    /**
     * 数据源配置
     */
    private static final DataSourceConfig DATA_SOURCE_CONFIG = new DataSourceConfig
            .Builder("jdbc:mysql://10.160.0.26:3306/test?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true", "cms", "cms")
            .schema("ly")
            .build();

    @Test
    public void testSimple() {
        AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
        generator.strategy(strategyConfig().build());
        generator.global(globalConfig().build());
        generator.execute();
    }
}
